Skip to content

Conversation

@eabz
Copy link
Contributor

@eabz eabz commented Oct 11, 2025

This PR introduces a flag to enable to users to initialize the database with SafeNoSync mode.

Fixes: #18565

Introduces:

  • Added a new element sync_mode to the DatabaseArguments and DatabaseArgs.
  • Added a TypedParser to make sure only Durable and SafeNoSync options are used.
  • Passes the variable to DatabaseArguments::new function.
  • Changed all the tests where DatabaseArguments::new is used to use the SafeNoSync mode.
  • Hardcodes the usage in stage/dump to Durable.
  • Argument defaults to Durable

Can you point me if the documentation update is necessary?

@eabz eabz changed the title feat: allow using SafeNoSync for MDBX database feat: allow using SafeNoSync for MDBX Oct 11, 2025
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supportive but I'd like to change the setup for this a bit so that we don't always need to provide the syncmode

unclear to me why some changes are now using SafeNoSync

this change should not alter existing logic

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Oct 17, 2025
@eabz
Copy link
Contributor Author

eabz commented Oct 18, 2025

Hey @mattsse, thanks for the feedback!

I’m really enthusiastic about making my first contribution to the reth repository.
I reviewed your suggestions and reverted many of my changes to the DatabaseArguments::new function. I also added a new function, with_sync_mode, to ensure that the flag is only passed to the database when explicitly used by the user.

Additionally, I removed all the modifications I had made to the test functions.

I believe this approach aligns much better with the current codebase. I’m still getting familiar with how things work in reth, but I’m excited to keep learning and improving.

Let me know if there is something else I need to change.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last suggestion

other than that lgtm

pending @shekhirin

@eabz
Copy link
Contributor Author

eabz commented Oct 18, 2025

Changed the parser to be easier by creating a FromStr function to the SyncMode.

Let me know if there are any other modifications required.

Copy link
Collaborator

@shekhirin shekhirin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is useful. LGTM!

@shekhirin shekhirin requested a review from mattsse October 24, 2025 09:49
@shekhirin shekhirin added this pull request to the merge queue Oct 24, 2025
/// Controls how aggressively the database synchronizes data to disk.
#[arg(
long = "db.sync-mode",
value_parser = value_parser!(SyncMode),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure if we even need this now that syncmode is fromstr

Merged via the queue into paradigmxyz:main with commit a767fe3 Oct 24, 2025
40 of 41 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Oct 24, 2025
Charlie-Mack pushed a commit to Charlie-Mack/reth that referenced this pull request Oct 27, 2025
Co-authored-by: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

allow using SafeNoSync for mdbx to increase write performance

4 participants